<template>
	<view>
		<view class="" v-if="false">
			<view class="pp20 fj" style="color: #848484;font-size: 28rpx;">
				<view :class="{'sele':index == sele}" v-for="(i,index) in tag_list" @click="choose(index)" :key="index">
					{{i.title}}({{i.count}})
				</view>
			</view>
			<view class="line">
			</view>
		</view>
		<view class="">
			<block class="item mb-5 " tyle="border-bottom: 1px solid #F0F0F0; padding-bottom: 30rpx;"
				v-for="(val,i) in messageList" :key="i">
				<view class="fa pp10"
					@click="goChat(val)">
					<u-avatar :src="val.avatar" style="padding-right: 15px;"></u-avatar>
					<view class="">
						<view class="f15 fa" style="color: #A2A2A2;">
							<view class="f1">
								<text style="color: #161616;" class="mr20">{{val.name}}</text> <text class="mr20">
									{{ setStatus(val.gender)}}</text> <text>{{val.age}}岁</text>
							</view>
							<view class="f12">
								{{val.createTime}}
							</view>
						</view>
						<view class="f13 ca2 mt5 text-ellipsis " style="width: 300px;">
							{{val.diseaseDescription}}
						</view>
						<view class="mt5" v-if="false">
							<view class="" style="background-color: #F5EFEA;color: #FFB444;font-size: 22rpx;width: 90rpx;text-align: center;
							border-radius: 30rpx;">
								咳嗽
							</view>
						</view>
					</view>
				</view>

			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sele: 0,
				tag_list: [{
						title: '全部',
						count: 1
					},
					{
						title: '问诊中',
						count: 1
					},
					{
						title: '待接诊',
						count: 1
					},
					{
						title: '预约',
						count: 1
					},
				],
				// patient: uni.getStorageSync('patient')
				patient: [],
				messageList: [],
				options1: [{
					text: '删除',
					style: {
						backgroundColor: '#f56c6c'
					}
				}]
			}
		},
		onShow() {
			this.chatList()
		},
		onLoad() {

		},
		methods: {
			/*  */
			goChat(val){
				console.log(val,"val");
				uni.setStorageSync('orderNo',val.orderNo)
				this.$pub.go(`/pages/online/online?data=${encodeURIComponent(JSON.stringify(val))}&dis=${val.diseaseDescription}`)
			},
			deleteItem(e) {
				let index = e.index
				this.messageList.splice(index, 1)
				console.log(this.messageList, "me");
			},

			setStatus(status) {
				let obj = {
					1: "男",
					2: "女"
				}
				return obj[status]
			},
			choose(index) {
				this.sele = index
			},
			async chatList() {
				let re = await this.$API.messageApi.listByDoctor(1)
				console.log(re, "re");
				this.messageList = re
			}
		},
	}
</script>

<style>
	.sele {
		color: #2D81FF;
	}
</style>